From: Owen W. Taylor Date: Wed, 9 Feb 2011 23:54:46 +0000 (-0500) Subject: Improve allocation of workspace controls X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~8975 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=630f0f0ac84209ad3c1dae616bde1d1156155f0d;p=gnome-shell.git Improve allocation of workspace controls Fix a bug in the computation of the zoomed-out scale and use a StBin instead of an unnecessary StBoxLayout. Using the StBin will allow correct width-for-height behavior for the controls. https://bugzilla.gnome.org/show_bug.cgi?id=641879 --- diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 55f198726..691ef67a4 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -594,8 +594,9 @@ WorkspacesDisplay.prototype = { this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight)); this.actor.connect('allocate', Lang.bind(this, this._allocate)); - let controls = new St.BoxLayout({ vertical: true, - style_class: 'workspace-controls' }); + let controls = new St.Bin({ style_class: 'workspace-controls', + request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT, + y_align: St.Align.START }); this._controls = controls; this.actor.add_actor(controls); @@ -605,7 +606,7 @@ WorkspacesDisplay.prototype = { Lang.bind(this, this._onControlsHoverChanged)); this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox(); - controls.add(this._thumbnailsBox.actor, { expand: false }); + controls.add_actor(this._thumbnailsBox.actor); this.workspacesView = null; @@ -638,7 +639,7 @@ WorkspacesDisplay.prototype = { let totalWidth = totalAllocation.x2 - totalAllocation.x1; let totalHeight = totalAllocation.y2 - totalAllocation.y1; - let [controlsMin, controlsNatural] = this._controls.get_preferred_width(-1); + let [controlsMin, controlsNatural] = this._controls.get_preferred_width(totalHeight); let controlsReserved = controlsNatural * (1 - CONTROLS_POP_IN_FRACTION); totalWidth -= controlsReserved; @@ -664,7 +665,7 @@ WorkspacesDisplay.prototype = { if (rtl) x += controlsReserved; - let zoomScale = (totalWidth - controlsNatural) / totalWidth; + let zoomScale = (totalWidth - (controlsNatural - controlsReserved)) / totalWidth; let newView = new WorkspacesView(width, height, x, y, zoomScale, this._workspaces); if (this.workspacesView)